#include "StdAfx.h"
#include "Runnable.h"

Runnable::Runnable(void)
{
}

Runnable::~Runnable(void)
{
}

ThreadRunner::ThreadRunner(Runnable* runnable, int sleepMillis)
{
	this->runnable = runnable;
	this->sleepMillis = sleepMillis;
	isRunning = false;
}

ThreadRunner::~ThreadRunner(void)
{
}

void ThreadRunner::Start()
{
	Launch();
}

void ThreadRunner::Stop()
{
	isRunning = false;
	Thread::Terminate();
}

void ThreadRunner::Run()
{
	isRunning = true;
	while(isRunning)
	{
		runnable->Run();
		Sleep(sleepMillis);
	}
}